nums1 = [4,1,2]
nums2 = [1,3,4,2]
def nextGreaterElement(nums1,nums2):
    res=[]
    for i in nums1:
        i_index=nums2.index(i)+1
        is_find=False
        while i_index<len(nums2):
            if i<nums2[i_index]:
                is_find=True
                res.append(nums2[i_index])
                break
            else:
                i_index+=1
        if not is_find:
            res.append(-1)
    print(res)
nextGreaterElement(nums1,nums2)
